package uit.ce.hungtrung;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import uit.ce.hungtrung.game.lib.game2d.Sprite;

public class Basket extends Entity {

	private int xMin, xMax, yMin, yMax;
	private int typeMove;
	private int speed = 10;

	public Basket(Context context, int scr_Width, int scr_Height, int type) {
		super(context, R.drawable.basket);
		xMin = 0;
		xMax = scr_Width - getSprite().getWidth();
		yMin = 0;
		yMax = scr_Height - getSprite().getHeight();
		this.typeMove = type;

	}

	public void Render(Canvas canvas) {
		Draw(canvas);
	}

	protected void Draw(Canvas canvas) {
		setPositionXY(currentX, currentY);
		getSprite().DrawIamge(canvas);
	}

	public void Update() {
		MoveBasket();
	}

	// TH_0 : gio dung yen
	// TH_1 : gio di chuyen qua lai voi van toc ban do

	public void MoveBasket() {
		switch (typeMove) {
		case 0:

			break;
		case 1:
			if (currentX < xMin) {
				currentX = xMin;
				speed = -speed;
			} else if (currentX > xMax) {
				currentX = xMax;
				speed = -speed;
			}
			currentX += speed;
			break;

		default:
			break;
		}
	}

}
